package com.gzu.finalwork.user.repository;


import com.gzu.finalwork.entity.user.DeliveryTrack;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;

import java.time.LocalDateTime;

@Repository
public interface DeliveryTrackRepository extends MongoRepository<DeliveryTrack, String> {
    
    // 根据配送订单ID查找轨迹
    DeliveryTrack findByDeliveryOrderId(Long deliveryOrderId);
    
    // 根据订单编号查找轨迹

    DeliveryTrack findByOrderNumber(String orderNumber);

    // 删除指定订单的轨迹
    void deleteByDeliveryOrderId(Long deliveryOrderId);
    /**
     * 查找指定时间范围内更新的轨迹
     */
    DeliveryTrack findByUpdatedAtBetween(LocalDateTime start, LocalDateTime end);
    
    /**
     * 根据城市查找轨迹
     */
//    @Query("{'currentLocation.city': ?0}")
//    List<DeliveryTrack> findByCurrentLocationCity(String city);

}